package com.sh.business.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sh.business.domain.UserInvest;
import com.sh.business.domain.bo.UserInvestBo;
import com.sh.business.domain.vo.DailyInvestVo;
import com.sh.business.domain.vo.UserInvestStatisticsVo;
import com.sh.business.domain.vo.UserInvestVo;
import com.sh.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 用户投资记录Mapper接口
 *
 * @author ruoyi
 * @date 2024-10-08
 */
public interface UserInvestMapper extends BaseMapperPlus<UserInvest, UserInvestVo> {

    List<UserInvest> query20250422Invest();


    UserInvest queryByOrderSnAndDeleted(String orderSn);

    /**
     * 补发172 usdt团队奖励
     * @return
     */
    List<UserInvest> query172List();

    default UserInvest queryByTxHash(String txHash) {
        return selectOne(Wrappers.<UserInvest>lambdaQuery().eq(UserInvest::getTxHash, txHash));
    }

    default UserInvest queryByOrderSn(String orderSn) {
        return selectOne(Wrappers.<UserInvest>lambdaQuery().eq(UserInvest::getOrderSn, orderSn));
    }

    /**
     * 今日新增购买
     */
    BigDecimal queryTodayInvestAmount();
    /**
     * 累计购买
     */
    BigDecimal queryTotalInvestAmount();

    /**
     * 查询日统计
     * @return
     */
    Page<DailyInvestVo> queryDailyInvest(@Param("page") Page<DailyInvestVo> page);

    /**
     * 查询列表
     * @return
     */
    Page<UserInvestVo> queryInvestList(@Param("bo") UserInvestBo bo, @Param("page") Page<UserInvestVo> page);

    /**
     * 统计
     * @param bo
     * @return
     */
    UserInvestStatisticsVo queryUserInvestStatistics(@Param("bo") UserInvestBo bo);

    List<UserInvest> queryUserTodayAchievementList();

    /**
     * 查询用户最新购买时间
     * @return
     */
    List<UserInvest> queryUserPurchaseTimeLastList(@Param("userIdList") List<Long> userIds);
}
